<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <!-- <script>
        let arr =["1", "2", "3", "4"]
        arr.reverse()
        console.log(arr);
    </script> -->
        <!-- <script>
            let arr = ["a", "b", "c", "d"];
            // arr=[]
            // console.log(arr);
            arr.length = 0;
            console.log(arr);
        </script> -->
        <script>
            const arr = ["a", "b", "c", "d"];

            const str = "c";
            const str1 = "e";

            // str 在 arr 的下标是多少

            const index = arr.indexOf(str); //2
            console.log("index", index);

            // 假如在数组中找不到 会返回 -1
            console.log("e的下标", arr.indexOf(str1));

            // 可以判断值是否在数组中
            console.log("f是否在数组中：", arr.indexOf("f") !== -1);
            console.log("a是否在数组中：", arr.indexOf("a") === -1);
        </script>
    </body>
</html>
